package com.ruoyi.rule.domain;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 规则引擎：执行动作类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RuleAction implements  Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    /**
     * 规则id
     */
    private Long ruleId;

    /**
     * ActionType.java
     */
    private String name;

    /**
     * ActionType.java
     * 动作类型，例如：通知(短信，电话，公众号，钉钉等)/设备联动控制/url调用/
     */
    private String type;


    /**
     * 示例：携带参数JSON字符串，具体内容根据业务制定，最终对应：dto包下面的对象即可
     * 执行指令：{"productKey":"xxx","channelKey":"xxx","deviceKey": "xxx","params": {"switch": "on"}}
     * 发送短信：{"userId": "13800000000","msg": "短信内容"}
     * 拨打电话：{"userId": "13800000000","msg": "电话内容"}
     * 公众号通知：{"userId": "xxx","title":"标题","msg": "公众号内容"}
     * 钉钉通知：{"userId": "xxx","hookUrl":"https://2343","title":"标题","msg": "钉钉内容"}
     * 发送邮件：{"email": "xxx@xxx.com","title": "邮件标题","content": "邮件内容"}
     * 调用URL：{"url": "http://xxx.com/api","params": {"key":"value"},"method": "POST","headers": {"key":"value"}
     */
    private String params ;

    /**
     * 该字段不在数据库，规则执行中使用
     * success/fail/processing
     */
    private String status;

    /**
     * 该字段不在数据库，规则执行中使用
     * 执行结果，执行成功/错误描述
     */
    private String result;

}
